using System;
using System.Collections.Generic;
using System.ComponentModel;
using Iesi.Collections;
using Iesi.Collections.Generic;
using METODESA.Server.Data.Components;
using METODESA.Server.Data.Exceptions;
using METODESA.Server.Data.METODESA.Entity;

namespace METODESA.Server.Data.METODESA.Entity 
{    
	/// <summary>
	/// An object representation of the Telefono table
	/// </summary>
	[Serializable]
	public partial class Telefono
	{
		private System.Int32 _Id;

		private Cliente _Cliente;
		private System.String _Numero;
		private Proveedor _Proveedor;


	    public Telefono()
	    {
	    }

	    public Telefono(Cliente _Cliente, string _Numero, Proveedor _Proveedor)
	    {
	        this._Cliente = _Cliente;
	        this._Numero = _Numero;
	        this._Proveedor = _Proveedor;
	    }

	    public virtual Cliente Cliente
		{
			get
			{
				return _Cliente;
			}
			set
			{
				_Cliente = value;
			}
		}
		public virtual System.Int32 Id
		{
			get
			{
				return _Id;
			}
			set
			{
				_Id = value;
			}
		}

		public virtual System.String Numero
		{
			get
			{
				return _Numero;
			}
			set
			{
				if (value == null)
				{
					throw new BusinessException("NumeroRequired", "Numero must not be null.");
				}
				_Numero = value;
			}
		}

		public virtual Proveedor Proveedor
		{
			get
			{
				return _Proveedor;
			}
			set
			{
				_Proveedor = value;
			}
		}

		protected bool Equals(Telefono entity)
		{
			if (entity == null) return false;
			if (!base.Equals(entity)) return false;
			if (!Equals(_Id, entity._Id)) return false;
			return true;
		}

		public override bool Equals(object obj)
		{
			if (ReferenceEquals(this, obj)) return true;
			return Equals(obj as Telefono);
		}

		public override int GetHashCode()
		{
			int result = base.GetHashCode();
			result = 29*result + _Id.GetHashCode();
			return result;
		}

	}
}
